<?php
/**
 *
 *
 * @author Zeon <scplay@gmail.com>
 * @date 2018/6/29 8:52
 * @copyright PanxSoft Inc.
 */

namespace Tests\Concerns;

use App\Exceptions\ApiErrCode;
use Illuminate\Foundation\Testing\TestResponse;
use Tests\TestCase;

/**
 * Trait ApiAssertable
 *
 * @package Tests\Concerns
 */
trait ApiAssertable
{
    /**
     * @param TestResponse $res
     */
    protected function assertApiOk(TestResponse $res)
    {
        $res->assertJson(['code' => ApiErrCode::API_CODE_OK]);
    }

    /**
     * @param TestResponse $res
     * @param int $code
     */
    protected function assertApiCode(TestResponse $res, int $code)
    {
        $res->assertJson(['code' => $code]);
    }
}